//
//  CYDXWebVC.m
//  CreditAddressBook
//
//  Created by Mosu&Cuu on 16/6/28.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "CYDXWebVC.h"
#import "CYUser.h"
#import "CYLoginHttpTool.h"


@interface CYDXWebVC ()<UIWebViewDelegate>

@property (nonatomic, strong)UIWebView *webview;
@property (nonatomic, strong)UIView *hiview;
@property (nonatomic, assign)BOOL isfirstLoad;
@property (nonatomic, strong)NSString *url1;

@end

@implementation CYDXWebVC

- (void)viewDidLoad {
    [super viewDidLoad];
     
     
     self.view.backgroundColor = [UIColor blackColor];
     _webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen ]bounds].size.width,[[UIScreen mainScreen ]bounds].size.height)];
     _webview.backgroundColor = CYColor(68, 68, 68, 1);
     _webview.delegate = self;
          NSString *url= @"http://login.189.cn/login";
          NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url]];
          [_webview loadRequest:request];
     [self.view addSubview:_webview];
     
     UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0,0,50,30)];
     rightButton.titleLabel.textColor = [UIColor blackColor];
     [rightButton addTarget:self action:@selector(submitclick) forControlEvents:UIControlEventTouchUpInside];
     [rightButton setTitle:@"确定" forState:UIControlStateNormal];
     UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
     self.navigationItem.rightBarButtonItem= rightItem;

     self.isfirstLoad = YES;

     
    // Do any additional setup after loading the view from its nib.
}

-
(void)webViewDidFinishLoad:(UIWebView *)webView {
     NSString *jsToGetHTMLSource =
     @"document.getElementsByTagName_r('html')[0].innerHTML";
     
     NSString *HTMLSource = [self.webview
                             stringByEvaluatingJavaScriptFromString:jsToGetHTMLSource];
     
     NSLog(@"%@",HTMLSource);
     
}

-(void) submitclick{
     
     
     
     
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
